using Sustainalytics.ESGRatings.Primitives;
using System;

namespace Sustainalytics.ESGRatings.BusinessLogic.Computing
{
    public class GovernanceComputeResult : IDisposable
    {
        private bool _disposed;

        ~GovernanceComputeResult()
        {
            Dispose(false);
        }

        public Guid[] CompaniesMap { get; set; }

        public int[] CompanyGroupMappings { get; set; }

        public IndicatorsConfiguration Configuration { get; set; }

        public bool IncludeWeightedScores { get; set; }

        public bool IncludeWeights { get; set; }

        // Null if CompaniesNo = 0
        public GovernanceRatingsResult Ratings { get; set; }

        public Guid SetId { get; set; }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                if (Ratings != null)
                {
                    Ratings.Dispose();
                }
            }

            _disposed = true;
        }
    }
}